package Wires.diagram.edit.helpers;

import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;

import Wires.GenericTransformation;
import Wires.TypeParameter;
import Wires.WiresFactory;

/**
 * @generated
 */
public class GenericTransformationEditHelper extends
		Wires.diagram.edit.helpers.WiresBaseEditHelper {

	/**
	 * @generated NOT
	 */
	@Override
	protected ICommand getConfigureCommand(final ConfigureRequest req) {
		return new ConfigureElementCommand(req) {
			protected CommandResult doExecuteWithResult(
					IProgressMonitor monitor, IAdaptable info)
					throws ExecutionException {
				EObject element = req.getElementToConfigure();
				doElementCreation(element, monitor);
				return CommandResult.newOKCommandResult(element);
			}
		};
	}

	/**
	 * @generated NOT
	 */
	protected void doElementCreation(EObject element, IProgressMonitor monitor) {
		GenericTransformation gentransf = (GenericTransformation) element;

		TypeParameter typeParam = WiresFactory.eINSTANCE.createTypeParameter();

		gentransf.setTypeParam(typeParam);
	}
}
